home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / kernel / sync / syncInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  1.7 KB  |  70 lines

  1. /* * syncInt.h --
  2.  *
  3.  *    Declarations of internal procedures of the sync module.
  4.  *
  5.  * Copyright (C) 1985 Regents of the University of California
  6.  * All rights reserved.
  7.  *
  8.  *
  9.  * $Header: /cdrom/src/kernel/Cvsroot/kernel/sync/syncInt.h,v 9.1 90/10/05 17:50:26 mendel Exp $ SPRITE (Berkeley)
  10.  */
  11.  
  12. #ifndef _SYNCINT
  13. #define _SYNCINT
  14.  
  15. /*
  16.  *----------------------------------------------------------------------
  17.  *
  18.  * SyncAddLockStats --
  19.  *
  20.  *    Adds the statistics for the given lock to the type total.
  21.  *
  22.  * Results:
  23.  *    None.
  24.  *
  25.  * Side effects:
  26.  *    None.
  27.  *    
  28.  *----------------------------------------------------------------------
  29.  */
  30.  
  31. #define SyncAddLockStats(regPtr, lock)                     \
  32.     {                                     \
  33.      (regPtr)->hit += FIELD(lock, hit);                 \
  34.     (regPtr)->miss += FIELD(lock, miss);                 \
  35.     if (((Sync_Lock *) lock)->type == SYNC_LOCK) {             \
  36.         SyncMergePrior((Sync_Lock *) (lock), (regPtr));        \
  37.     } else {                            \
  38.         SyncMergePrior((Sync_Semaphore *) (lock), (regPtr));    \
  39.     }                                \
  40.     }
  41.  
  42. extern void SyncEventWakeupInt _ARGS_((unsigned int event));
  43. extern Boolean SyncEventWaitInt _ARGS_((unsigned int event, 
  44.                     Boolean wakeIfSignal));
  45.  
  46. /*
  47.  *----------------------------------------------------------------------
  48.  *
  49.  * FIELD --
  50.  *
  51.  *    Some of the routines take either semaphores or locks as parameters.
  52.  *    This macro is used to get the desired field from the object,
  53.  *    regardless of its type.
  54.  *
  55.  * Results:
  56.  *    Value of the field.
  57.  *
  58.  * Side effects:
  59.  *    None.
  60.  *
  61.  *----------------------------------------------------------------------
  62.  */
  63.  
  64. #define FIELD(lock,name) ( \
  65.     ((Sync_Lock *) (lock))->class == SYNC_SEMAPHORE ? \
  66.     ((Sync_Semaphore *) (lock))->name : \
  67.     ((Sync_Lock *) (lock))->name ) 
  68.  
  69. #endif /* _SYNCINT */
  70.